package com.cskaoyan.weixin.service;

import com.cskaoyan.mapper.*;
import com.cskaoyan.weixin.bean.home.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class WxHomeServiceImpl implements WxHomeService {

    @Autowired
    GoodsMapper goodsMapper;
    @Autowired
    CouponMapper couponMapper;
    @Autowired
    CategoryMapper categoryMapper;
    @Autowired
    AdMapper adMapper;
    @Autowired
    BrandMapper brandMapper;
    @Autowired
    TopicMapper topicMapper;
    @Override
    public WxHomeVO index() {
        WxHomeVO wxHomeVO = new WxHomeVO();
        List<NewGoodsListBean> newGoodsList =  goodsMapper.selectNewGoods();
        List<CouponListBean> couponList = couponMapper.selectCoupon();
        List<ChannelBean> channel = categoryMapper.selectChannel();
        List<GrouponListBean> grouponList = new ArrayList<>();
        List<BannerBean> banner = adMapper.selectBanner();
        List<BrandListBean> brandList = brandMapper.selectBrands();
        List<HotGoodsListBean> hotGoodsList = goodsMapper.selectHotGoods();
        List<TopicListBean> topicList = topicMapper.selectTopics();
        List<FloorGoodsListBean> floorGoodsList = categoryMapper.selectFloorGoods();
        wxHomeVO.setNewGoodsList(newGoodsList);
        wxHomeVO.setCouponList(couponList);
        wxHomeVO.setChannel(channel);
        wxHomeVO.setGrouponList(grouponList);
        wxHomeVO.setBanner(banner);
        wxHomeVO.setBrandList(brandList);
        wxHomeVO.setHotGoodsList(hotGoodsList);
        wxHomeVO.setTopicList(topicList);
        wxHomeVO.setFloorGoodsList(floorGoodsList);
        return wxHomeVO;
    }
}
